<template>
	<view class="pad-16r">
		<!-- 出院结算详情 -->
		<view class=" item">
			<view class="between-center">
				<view class="border-col font-weight">住院日信息</view>
				<!-- <view class="status-1" v-if="item.status==1">已出院</view> -->
				<!-- <view class="status-0" v-else>未出院</view> -->
			</view>
			<view>
				<view class="start-center">
					<view class="item-title">住院患者</view>
					<view>{{item.patName}}</view>
				</view>
				<view class="start-center">
					<view class="item-title">住院号</view>
					<view>{{item.medicalRecordNo}}</view>
				</view>
				<view class="start-center">
					<view class="item-title">床位号</view>
					<view>{{item.bedNo}}</view>
				</view>
				<view class="start-center">
					<view class="item-title">住院院区</view>
					<view>{{item.campusName}}</view>
				</view>
				<view class="start-center">
					<view class="item-title">住院科室</view>
					<view>{{item.departmentName}}</view>
				</view>
				<view class="start-center">
					<view class="item-title">入院日期</view>
					<view>{{item.inHospitalTime}}</view>
				</view>
				<view class="start-center">
					<view class="item-title">出院日期</view>
					<view>{{item.leaveHospitalTime}}</view>
				</view>
				<view class="start-center">
					<view class="item-title">住院天数</view>
					<view>{{inHospitalDay}} 天</view>
				</view>
			</view>
		</view>
		<view class="item">
			<view class="border-col font-weight">出院预结</view>
			<view>
				<view class="between-center">
					<view class="item-title-100">费用总金额：</view>
					<view>￥{{item.totalMoney}}</view>
				</view>
				<view class="between-center">
					<view class="item-title-100">医保支付金额：</view>
					<view>￥{{item.fundPaySumamt}}</view>
				</view>
				<view class="between-center">
					<view class="item-title-100">个人支付金额：</view>
					<view>￥{{item.psnPayMoney}}</view>
				</view>
				<view class="between-center">
					<view class="item-title-100">住院预交金额：</view>
					<view>￥{{item.psnPrepayMoney}}</view>
				</view>
			</view>
			<view class="border-row"></view>
			<view class="flex-end mar-10-0">
				<view>需退款金额：<text class="color-red">￥{{item.refundMoney}}</text></view>
			</view>
		</view>
		<ButtonVue content="确认结算" @click="toPageSuccess(item)"></ButtonVue>
		<view class="text-center color-blue" @click="toPageList(item)">查看住院清单</view>
	</view>
</template>

<script>
	import {
		getDaysBetweenDates
	} from '../../../utils/assist'
	import ButtonVue from '../../../components/Button/Button.vue'
	export default {
		components: {
			ButtonVue
		},
		data() {
			return {
				item: {}
			}
		},
		computed: {
			inHospitalDay() {
				return getDaysBetweenDates(this.item.inHospitalTime, this.item.leaveHospitalTime)
			}
		},
		onLoad(e) {
			this.item = JSON.parse(e.item)
			console.log(this.item)
		},
		methods: {
			toPageList(item) {
				// 跳转到住院清单
				uni.navigateTo({
					url: `/pages/Home/ServeHospital/InHospitalListDetail?item=` + JSON.stringify(item)
				})
			},
			toPageSuccess(item) {
				uni.navigateTo({
					url: `/pages/Home/ServeHospital/LeaveHospitalSettlementSuccess?item=` + JSON.stringify(item)
				})
			}
		}
	}
</script>

<style scoped>
	.status-0 {
		background: #eba242;
		padding: 3px 10px;
		border-radius: 16rpx;
		color: white;
	}

	.status-1 {
		background: #0cbd30;
		padding: 3px 10px;
		border-radius: 16rpx;
		color: white;
	}
</style>